#!/bin/sh

(
    cd "$(dirname "$0")"

    printHelp(){

        echo "
usage 1 : $0 bits CN ZJ YH X y foo1.lan 'foo1.lan bar.lan *.bar.lan' 
usage 2 : $0 bits CN ZJ YH X y foo2.lan 'www.foo2.lan'
    bits = 512 or 1024 or 2048 4096 ...
        #(512 maybe not OK)
"

        echo '
        [ req_distinguished_name ]
        countryName                 = $2
        stateOrProvinceName         = $3
        localityName                = $4
        organizationName            = $5
        organizationalUnitName      = $6
        commonName                  = $7

        $8 ==> SAN == "a.lan b.lan foo.lan *.bar.lan"
'

        exit 0
    }

    if [ -z "$8" ] ;then
        printHelp
    fi

    sh ssl_req.sh  "$@"

)



